Date : 03/17/2020
Written by : Byungkyu Lee (bl11@indiana.edu)

README File for replication of all figures and tables reported in Lee, Dohoon and Byungkyu Lee, "The Role of Multilayered Peer Groups in Adolescent Depression: A Distributional Approach" _American Journal of Sociology_, 2020, forthcoming. 

This file contains Stata Do files and R codes to reproduce all figures and tables appeared in the main text as well as Appendix. 

## Data
`data` folder contains `rawdata` -- The restricted Add Health data are not included here, but can be accessed through: https://www.cpc.unc.edu/projects/addhealth/documentation/restricteduse -- as well as `processed` data folders. Once you have all the raw data into this `rawdata` folder, you should be able to reproduce all files in `processed` data folder, which can be used for all other analysis.

We use the following Add Health data sets. These dta files are transformed from the corresponding xpt files.

Inhome Wave 1 survey : `allwave1.dta`
Inhome Wave 2 survey : `wave2.dta`
Wave 1 2 Survey weights : `weight_wave1.dta` and `weight_wave2.dta` 
Inschool survey : `inschool.dta`
Inschool friendship network : `sfriend.dta`
Wave 3 Course Taking data : `edunet.xpt`

## Workflow
1. Run `DEP_clean_inhome_inschool.do` file to process `allwave1.dta`, `wave2.dta` and `inschool.dta` data.
2. Run `DEP_clean_data.R` to measure peer group characteristics and produce data tables for regression analysis.
3. Run `DEP_RUN_random_peer.R` to run simulation of peer group matching.
4. Run `DEP_RUN_analysis_tables.do` to produce all Tables.
5. Run `DEP_RUN_analysis_figure.do` to produce all Figures.

## Output
`output` folder contains the final results. Again, we are not allowed to include the raw data or simulated data here, but we include `sim_grade_model_coef.fst` file that includes 1000 coefficients from simulation exercises that you can use to re-produce `falsification_random_peer.pdf` figure (Figure 4).

## Program Version Information : 
-- Stata 14 SE version for all analysis.
-- R 3.5.3 for all analysis.

If you have any question on these files or fail to reproduce any of figures or tables, then please direct your correspondence to BK Lee (bklee009@gmail.com). 

